package business;

import entity.Invitation;
import entity.InvitationPK;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

@Stateless
public class InvitationManager {
    
    @PersistenceContext
    private EntityManager entityManager;
    
    public void create(Invitation invitation) {
        entityManager.persist(invitation);
    }

    public boolean exists(InvitationPK key) {
        return entityManager.find(Invitation.class, key) != null;
    }

    public Invitation find(InvitationPK key) {
        return entityManager.find(Invitation.class, key);
    }

    public void delete(Invitation invitation) {
        entityManager.remove(entityManager.merge(invitation));
    }
}
